<%-- 
    Document   : save
    Created on : Mar 11, 2014, 11:09:28 PM
    Author     : kenn
--%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<sql:setDataSource var="ds" driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost/bonix"
                   user="root" password=""/>

<sql:update dataSource="${ds}">
    UPDATE profile SET first_name = '<%=request.getParameter("first")%>', last_name = '<%=request.getParameter("last")%>', 
    contact = '<%=request.getParameter("cont")%>', bdate = '<%=request.getParameter("bd")%>', email = '<%=request.getParameter("em")%>'
    WHERE username = '<%=request.getParameter("usernam")%>'
</sql:update>

<sql:update dataSource="${ds}">
    UPDATE accounts SET password = '<%=request.getParameter("pas")%>'
    WHERE username = '<%=request.getParameter("usernam")%>'
</sql:update>    
<c:redirect url="profile.jsp"/>